package com.lz.blog.controller;

import com.lz.blog.service.SysUserService;
import com.lz.blog.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author Liz
 * @date 2023/02/13 17:28
 **/
@RestController
@RequestMapping("users")
public class UserController {
    @Resource
    private SysUserService sysUserService;

    /**
     * 获取头部信息
     *
     * @param token
     * @return
     * @RequestHeader：使用此注解进行获取
     */
    @GetMapping("currentUser")
    public Result currentuser(@RequestHeader("Authorization") String token) {

        return sysUserService.findUserByToken(token);
    }

}
